﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace MvcControlToolkit
{
    public class ResourceTracker
    {
        private readonly string _resourceKey = "__resources";   
  
        private List<string> _resources;   
  
        public ResourceTracker(HttpContextBase context)   
        {
            this._resources = (List<string>)context.Items[this._resourceKey];
            if (this._resources == null)   
            {
                this._resources = new List<string>();
                context.Items[this._resourceKey] = this._resources;   
            }   
        }   
  
        public void Add(string url)   
        {   
            url = url.ToLower();

            if(!this.Contains(url))
                this._resources.Add(url);   
        }   
  
        public bool Contains(string url)   
        {   
            url = url.ToLower();
            return this._resources.Contains(url);   
        }          
    }   
}